@extends('backend::layout')
@section('title',$page_title)
@section('content')
    @component('backend::component.table.table-content')
        @slot('page_title') {{$page_title}} @endslot
        @slot('tools_btn')
            <a href="{{route('b_lottery_prize_create')}}"  class="btn btn-primary btn-sm">
                <i class="yhficon yhficon-notice"></i>&nbsp;添加奖品
            </a>
        @endslot
        @slot('body_content')
            @if($list->isNotEmpty())
                <div class="media-list  position-relative">
                    <div class="table-responsive">
                        <table class="table table-padded table-xl mb-0">
                            <thead>
                            <tr>
                                <th class="border-top-0">
                                    @component('backend::component.checkbox')
                                        @slot('name') ids-all @endslot
                                    @endcomponent
                                </th>
                                <th class="border-top-0">ID</th>
                                <th class="border-top-0">名称</th>
                                <th class="border-top-0">图片</th>
                                <th class="border-top-0">权重</th>
                                <th class="border-top-0">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($list as $item)
                                <tr>
                                    <td class="text-truncate">
                                        @component('backend::component.checkbox')
                                            @slot('name') id[] @endslot
                                            @slot('class') id @endslot
                                            @slot('value') {{$item->id}} @endslot
                                        @endcomponent
                                    </td>
                                    <td>{{$item->id}}</td>
                                    <td>
                                        {{$item->title}}
                                    </td>
                                    <td>
                                        <img src="{{$item->cover}}" style="height: 40px;" />
                                    </td>
                                    <td>
                                        {{$item->power}}
                                    </td>
                                    <td class="text-truncat mr-1">
                                        <a href="{{route('b_lottery_prize_update',['id'=>$item['id']])}}"
                                           class="btn btn-info btn-sm modal-box"
                                           data-params='{"area":"500px,77%","title":"修改公告"}'
                                        >
                                            <i class="hcl hcl-edit"></i>
                                        </a>
                                        <button class="btn btn-danger btn-sm btn-ajax"
                                                data-params='{"confirm":true,"url":"{{route('b_lottery_prize_delete',['id'=>$item['id']])}}"}'
                                        > <i class="hcl hcl-delete"></i></button>
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                </div>
            @else
                @include('backend::public.empty_page',['info'=>'暂无内容'])
            @endif
        @endslot
    @endcomponent
@endsection
@push('scripts')
    <script type="text/javascript">
        layui.use(['jquery','layer'],function () {
            var $ = layui.jquery,layer = layui.layer;
            $('.article-content').each(function () {
                $(this).off().on('click',function () {
                    layer.open({
                        type:1,
                        title:$(this).attr('title'),
                        area:['500px','500px'],
                        content:"<div class='card-body'>"+$(this).data('content')+"</div>"
                    });
                })
            })
        })
    </script>
@endpush